﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using AvatarHelper;
using Avatar.Model;

public partial class UserControl_Area : System.Web.UI.UserControl
{
    List<Area> _location;

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Cache["LocationIndex"] == null)
            {
                using (var _adc = DBHelper.GetDataContext())
                {
                    _location = _adc.Area.Where(a => a.FatherID == 5).OrderByDescending(i => i.Order).ToList();
                    Cache.Insert("LocationIndex", _location, null, DateTime.Now.AddMinutes(60), TimeSpan.Zero);
                }
            }
        }
        _location = (List<Area>)Cache["LocationIndex"];
        Repeater1.DataSource = _location;
        Repeater1.DataBind();
    }
}
